﻿package org.dm.3d.object.Works 
{
	import flash.display.BitmapData;
	import org.dm.3d.geom.Num3D;
	/**
	 * ...
	 * @author Scott
	 */
	public class Work 
	{
		public var vertices:Vector.<Num3D>;
		public var indices:Vector.<int>;
		public var uvtData:Vector.<Number>;
		public var mapData:BitmapData;
		public var z:Number;
		
		public function Work(pwidth:Number,pheight:Number,netNum:uint,pz:Number=0)
		{
			vertices = new Vector.<Num3D>();
			uvtData = new Vector.<Number>();
			indices = new Vector.<int>();
			this.z = pz;
			for (var i:uint = 0; i < netNum;i++ )
				for (var j:uint = 0; j < netNum; j++)
				{
					vertices.push(new Num3D((i-netNum/2) * pwidth, (j-netNum/2) * pheight,0));
					uvtData.push(i / (netNum-1), j / (netNum-1));
					if (i != 0 && j != 0)
					{
						indices.push((j - 1) * netNum + i, j * netNum + i, j * netNum + i - 1);
						indices.push((j - 1) * netNum + i, j * netNum + i - 1, (j - 1) * netNum + i - 1);
					}
				}
		}
		/*public function init(pwidth:Number,pheight:Number,netNum:uint):void 
		{
			for (var i:uint = 0; i < netNum;i++ )
				for (var j:uint = 0; j < netNum; j++)
				{
					vertices.push(i * pwidth, j * pheight);
					uvtData.push(i / (netNum-1), j / (netNum-1));
					if (i != 0 && j != 0)
					{
						daga.indices.push((j - 1) * netNum + i, j * netNum + i, j * netNum + i - 1);
						daga.indices.push((j - 1) * netNum + i, j * netNum + i - 1, (j - 1) * netNum + i - 1);
					}
				}
		}*/
	}
	
}